From: Ian Jackson Date: Fri, 3 Jun 2011 14:04:30 +0000 (+0100) Subject: tools/hotplug: Fix hotplug hook script arrangements not to always fail X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10224^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4bf3ca7bdbf89882bfa887f451843192fa275461;p=xen.git tools/hotplug: Fix hotplug hook script arrangements not to always fail The new feature introduced in 23401:a44b12ee2fd3 was broken; it in general always fails, at least if there are no hotplug scripts. If there are no hooks, call_hooks ends up running this: [ -x ".....*.hook" ] && . "..... *.hook" This does not directly trigger set -e and sigerr. However, it is the last command exected in call_hooks. So the return status of call_hooks is an error, and thus a sigerr happens when call_hooks returns. The bug affects xl and xm. However xl does not detect failure of the hotplug script. Change the script to use if...then rather than &&, as the latter has very confusing and undesirable semantics. Signed-off-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh b/tools/hotplug/Linux/xen-hotplug-common.sh index 95beab0ec5..8f6557df73 100644 --- a/tools/hotplug/Linux/xen-hotplug-common.sh +++ b/tools/hotplug/Linux/xen-hotplug-common.sh @@ -106,7 +106,7 @@ xenstore_write() { # call_hooks() { for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do - [ -x "$f" ] && . "$f" + if [ -x "$f" ]; then . "$f"; fi done }